/**************************************************************************//**
 * @file     pac5xxx_tile_SystemManager.h
 * @brief    CMSIS Header File for the PAC5XXX System Manager Tile
 *
 * @note
 * Copyright (C) 2015-2017, Active-Semi International
 *
 * THIS SOFTWARE IS SUBJECT TO A SOURCE CODE LICENSE AGREEMENT WHICH PROVIDES,
 * AMONG OTHER THINGS:  (i) THAT IT CAN BE USED ONLY TO ADAPT THE LICENSEE'S
 * APPLICATION TO PAC PROCESSORS SUPPLIED BY ACTIVE-SEMI INTERNATIONAL;
 * (ii) THAT  IT IS PROVIDED "AS IS" WITHOUT WARRANTY;  (iii) THAT
 * ACTIVE-SEMICONDUCTOR IS NOT LIABLE FOR ANY INDIRECT DAMAGES OR FOR DIRECT
 * DAMAGES EXCEEDING US$1,500;  AND (iv) THAT IT CAN BE DISCLOSED TO AND USED
 * ONLY BY CERTAIN AUTHORIZED PERSONS.
 *
 ******************************************************************************/

#ifndef PAC5XXX_TILE_SYSTEMMANAGER_H
#define PAC5XXX_TILE_SYSTEMMANAGER_H

/** @addtogroup PAC5XXX_Tile_SystemManager_INT PAC5XXX System Manager Tile
  @{
*/


#ifdef __CC_ARM  // KEIL Compiler
#pragma anon_unions
#endif

#ifdef CAFE_ARCH2
//================================
//========== CAFE_ARCH2 ==========
//================================
/*!< System Manager Tile Register Addresses */

//typedef enum {
//} System_Manager_Reg_Addr;

#else  // CAFE_ARCH1
//================================
//========== CAFE_ARCH1 ==========
//================================

/*!< System Manager Tile Register Addresses */

typedef enum {
	ADDR_SYSSTAT = 0x00,		            /*!< System Manager Status Register						        */
#if !defined(PAC5222)    
	ADDR_DEVID = 0x08,			            /*!< Device Identification Register					          	*/
	ADDR_VERID = 0x09,			            /*!< Version Identification Register				         	*/
#endif    
} System_Manager_Reg_Addr;

//
// Type Enumerations
//

/** PAC5XXX Threshold Voltage for Comparator AIO9-6 Type Enumeration */
typedef enum
{
	PAC5XXX_VTHRESH_0p1V = 0,			    /*!< Threshold voltage for comparator for AIO9-6: 0.1V  	    */
	PAC5XXX_VTHRESH_0p2V = 1,			    /*!< Threshold voltage for comparator for AIO9-6: 0.2V	        */
	PAC5XXX_VTHRESH_0p5V = 2,			    /*!< Threshold voltage for comparator for AIO9-6: 0.5V	        */
	PAC5XXX_VTHRESH_1p25V = 3,			    /*!< Threshold voltage for comparator for AIO9-6: 1.25V     	*/
} PAC5XXX_Vthresh_Comp_Type;

//
// Bit Definitions
//

/*!< System Manager Tile Registers */

/*!< SYSSTAT: Address: 0x00		System Manager Register */
typedef union
{
	__IO uint8_t b                      	: 8;
	struct {
		__IO uint8_t nINTM  				: 1;		/*!< Interrupt mask: 0: masked; 1: not masked	*/
		__IO uint8_t FLTM					: 1;		/*!< Fault mask: 0: not masked; 1: masked		*/
		     uint8_t        				: 1;
		__IO uint8_t REFBP					: 1;		/*!< Set external reference via AB5				*/
		__IO uint8_t VTHREF					: 2;		/*!< Threshold voltage for AIO<9:6> (00b: 0.1V, 01b: 0.2V, 10b: 0.5V, 11b: 1.25V	*/
		__I  uint8_t TMPWARN				: 1;		/*!< Temperature warning. Clear on read.		*/
		__IO uint8_t PBSTAT					: 1;		/*!< Push button status. Write 1 to clear.		*/
	};
} SYSSTAT;

#endif // #ifdef CAFE_ARCH2
/*@}*/ /* end of group PAC5XXX_Tile_SystemManager */

#endif  // PAC5XXX_TILE_SYSTEMMANAGER_H
